#ifndef EDITOR_H
#define EDITOR_H

#include <ZApplication.h>
#include <ZMainWidget.h>
#include <ZScrollView.h>
#include <ZPushButton.h>
#include <ZMultiLineEdit.h>
#include <ZMessageBox.h>
#include <ZGlobal.h>
#include <SetupSetManager.h>
#include <qwidget.h>
#include <qpixmap.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include <qvbox.h>
#include <qhbox.h>
#include <qlabel.h>
#include <qfile.h>
#include <qdir.h>
#include <qfileinfo.h>
#include <qfont.h>
#include <qstring.h>
#include <qstringlist.h>
#include <qcombobox.h>
#include <qspinbox.h>
#include <qtextstream.h>
#include <qtextcodec.h>
#include <qwhatsthis.h>
#include <ezxutilcst.h>
#include <ezxutildialog.h>
#include <ezxres.h>
#include <ezxutilpushbutton.h>
#include <ezxutillabel.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <ezxutilpushbutton.h> 


class UTIL_CST;
//class FileBrowser;
//#include "filebrowser.h"
class EzxLabel;

class Editor : public ZMainWidget
{
   	Q_OBJECT
public :
	Editor(char const *file,const QString& dir,QWidget *parent = 0, char const *name = 0,unsigned int f=0);
    virtual ~Editor();

    void load(const QString & FileName);
public :
    void setReadOnly(bool Codec);

public slots :
    void Save();
    //void SaveAs();
	void searchPre();
	void searchNext();
protected :
    void setText(const QString &FilePath,int Codec);
    void closeEvent( QCloseEvent *event );
    void cursorEvent( QMouseEvent *event );
protected slots:
   void ReadConfig();
   void SaveConfig();
private :
  //search
  int  curRow, curCol;
  int strL;
  uint current;
  uint  total, words;
  int x[65535],y[65535];
  //int iso_id,gbk_id,big5_id,utf8_id,utf16_id;
  int Width,tmpWidth;
  int w, h;
  int Full;
  int FontSize;
  bool wallpaper;
  int Background;
  int TextCodec;
  bool NumLines;
  int cm_wrap, full_popid, paste_popid;
  bool Ezxstyle;
  bool ShowTitle;
  bool AutoWrap;
  bool UnderLine;
  bool m_SaveAs;
  bool ReadOnly;
  bool OverWrite;
  bool Italic, Bold;
  bool caseSensitive, regExp;
  QString PreFile;
  QString dirname;
  QString filename;
  QString Color_s;
  QStringList ColorList;
  QString FileType;
  QStringList TypeList;
  QString srchStr,rpStr;
  
private :
	QWidget *searchwidget;
  EzxLabel* Title;
  QLabel* NumLine;
  ZScrollView* sv;
  ZMultiLineEdit *ml;
  ZMultiLineEdit* LineEdit_1;
  ZMultiLineEdit* LineEdit_2;
  QPopupMenu* CodecMenu;
  QPopupMenu *mPopup, *MenuML, *MenuMR;
  RES_ICON_Reader ir;
  //FileBrowser* mBrowser;
  UTIL_PushButton *FullScreenButton, *SeachBtn, *closeBtn;
 
  QLineEdit *input;
  QLineEdit *rpinput;
  ZPushButton *rpthis;
  ZPushButton *prebtn, *nextbtn, *hidesrh, *srchSetbtn, *rpbtn;
  QLabel *srchResult;
  
private slots :
  void srchW();
  void replaceW();
  void replacethis();
  void srchB();
  void srchSet();
  void FullScreen();
  //void NewFile();
  //void OpenFile();
  //void SelectFolder();
  void ChangeFile();
  void SelectAll();
  void undo1();
  void CmWrap();
  void Setup();
  void SetCodec(int codec_id);
  void About();
  void newWindow();
  void closeWindow();
  void copyTxt();
  void cutTxt();
  void pasteTxt();
  void deleteTxt();
  void info();
  void countwords();

};

#endif  //EDITOR_H
